/* 
 * File:   Pwm.h
 * Author: Julian Sanin
 *
 * Created on 9/02/2014, 16:30
 *
 * PWM implementation for PIC24FV-KA series.
 * Pin 16: OC1, RB7;
 * Pin 21: OC3, RB10;
 * Pin 22: OC2, RB11;
 */

#ifndef PWM_H
#define	PWM_H

#ifdef	__cplusplus
extern "C" {
#endif

#include "PeripheralModule.h"

CLASS_EXTEND(Pwm, PeripheralModule)
    /* No member needed. */
OVERRIDE(Pwm, PeripheralModule)
    void (*dtor)(Pwm *);
METHODS
    /**
     * @brief Enables a PWM output on a given mudule running with Tcy.
     * @param[in]  obj            The allocated Pwm object to be constructed.
     * @param[in]  module         The desired OC module.
     * @param[in]  dutyCycleValue The desired duty cycle value.
     * @param[in]  maximumValue   The desired maximum duty cycle value (100%).
     */
    void Pwm_ctor(Pwm *obj, int module, int dutyCycleValue, int maximumValue);
    void Pwm_dtor(Pwm *obj);
    /**
     * @brief Sets the duty cycle of the PWM module to a new value.
     * @param[in]  obj   The Pwm object.
     * @param[in]  value The new duty cycle value.
     */
    void Pwm_setDutyCycle(Pwm *obj, int value);
CLASS_END

#ifdef	__cplusplus
}
#endif

#endif	/* PWM_H */
